

function autoexec()

  set_ent_id(7, SARINA)
  set_ent_id(8, SARINA)
  set_ent_id(6, NOSLOM)

  if (get_progress(P_CHORES) == 6) then
    set_ent_active(8,0)
  end

return 
end

function refresh()
  
return
end

function postexec()
end

function zone_handler(zn)
  if (zn == 1) then    --door to outside
    change_map("townx","manor_exit");
 
  elseif (zn == 2) then  
    touch_fire(get_pidx(0)); 
 
  elseif (zn == 3) then 
    book_talk(get_pidx(0)); 


  end
end

function entity_handler(en)
  if (en == 0) then
   bubble(en,"Greetings!")

  elseif (en == 1) then
    bubble(en,"You are not permitted to enter any farther into the Governor's Mansion")

  elseif (en == 2) then
    if (get_progress(P_SPIDER) == 1) or  (get_progress(P_SPIDER) == 2) then   
      bubble(en,"I thank you for ridding Maldon of that spiderast.")
    else
      bubble(en,"How are you sir?")
      bubble(HERO1,"Uh... Fine")
      bubble(en,"Splendid.")
    end
  
  elseif (en == 3) then
    if (get_progress(P_SPIDER) == 1) or  (get_progress(P_SPIDER) == 2) then  
      bubble(en,"Kill a spider and then you think your something...")
      bubble(en,"You will always be the filthy son of Fiebraes the Mage General to me.")
    else 
      bubble(en,"Don't waste my time rifraf.")
    end

  elseif (en == 4) then
    bubble(en,"Gobble... snort...")
    bubble(en,"Can't you see I'm eating.")

  elseif (en == 5) then
     if (get_progress(P_SPIDER) == 1) or  (get_progress(P_SPIDER) == 2) then  
      bubble(en,"Thank you, Those spiders were really getting out of hand.") 
      bubble(en,"You saved me alot of paperwork. If we had had to organize an expedition... I won't bore you with the details.")
    else   
      bubble(en,"Ahh so much to be done!")
      bubble(en,"I have to write to the Earl of Windfallow... and then there is the letter from the ambassador of Lanaerta that needs to go to the king... I am much to busy to talk to you. Sorry.")
    end

  elseif (en == 6) then
    if (get_progress(P_SPIDER) == 1) then  
      set_progress(P_SPIDER,2)
      bubble(en,"$0, What do you have for me to day?")
      bubble(HERO1,"Here is the head of the spiderast as you requested. The spiders should no longer bother Maldon.")
      bubble(en,"That is excellent news.")
      bubble(en,"My battalion is filled with good men. But they didn't deem it necessary to do a work so unglamorous as fighting spiders.")
      bubble(en,"Secretly I think they were intimated to march into the lair of a spiderast.")
      set_ent_facing(3, FACE_RIGHT)
      wait_for_entity(3,3)
      wait(45)
      set_ent_facing(3, FACE_DOWN)
      wait_for_entity(3,3)
      if (get_progress(P_CHORES) == 6) then
      else
        bubble(8,"I would have done it father, if you had only permitted me to do so.")
        set_ent_facing(6, FACE_LEFT)
        wait_for_entity(6,6)
        bubble(en,"That's not required of you Sarina.")
        set_ent_facing(6, FACE_DOWN)
        wait_for_entity(6,6)
      end
      bubble(en,"Anyways... I was saying... Oh yes. Here is your reward.")
      set_gp(get_gp() + 200) 
      sfx(6)
      msg("The Governor gives you 200 gold.")
    end

    if (get_progress(P_CHORES) == 6) then
      if (get_progress(P_SPIDER) == 3) then 
        bubble(en,"It's good to see you again $0. Did you bring what I requested?")
      else
       bubble(en,"Hello $0, did you bring them?")
     end


     bubble(HERO1,"Yes sir. Here are the clothes you wanted.")
     bubble(en,"Sarina, can I have a word with you.")
     bubble(7,"Yes Father.")
     set_ent_script(1, "R1")
     set_ent_facing(1, FACE_DOWN)
     wait_for_entity(1,1)
     move_entity(7, "sarina")
     wait_for_entity(7,7)
     set_ent_script(1, "L1U1D1")
     set_ent_facing(1, FACE_DOWN)
     wait_for_entity(en,1)
     bubble(en,"Take a look at this wonderful new dress I bought you.")
     bubble(7,"It's great Father.")
     set_ent_facing(en, FACE_UP)
     bubble(en,"You don't sound very excited about it.")
     bubble(7,"I already told you that I much rather be around adventuring then...")
     set_ent_facing(en, FACE_DOWN)
     bubble(en,"Ah... sorry about that $0.")
   
     if (get_progress(P_SPIDER) == 3) then 
       bubble(en,"I am grateful for your service $0. Have something for your troubles.")
       set_gp(get_gp() + 100) 
       sfx(6)
       msg("The Governor gives you 100 gold.")
     else
       bubble(en,"Have something for your troubles.")
       set_gp(get_gp() + 50) 
       sfx(6)
       msg("The Governor gives you 50 gold.")
     end

     
     bubble(HERO1,"You treat me so well Governor.")
     bubble(HERO1,"Thank you.")
     set_progress(P_CHORES,7)
     set_progress(P_GIRL,1)

   else
     bubble(en,"Thank you so much $0.")  
  
   end

  
  elseif (en == 7) then
    bubble(en,"Thank you.") 

  elseif (en == 8) then
    bubble(en,"Someday I will go on an adventure like you.") 
 
  
  end
  end
  



